<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script src="js/jquery-1.11.0.min.js"></script>
</head>
<body>

选择二类卡卡号：<select name="card2_num" id="card2_num" >
<!--    <span style="color: red"></span>-->

</select>
<br>
选择一类卡卡号:<select name="account_id1" id="account_id1">
</select>

<br>
输入提现金额：<input type="text" name="money" id="money" value="">
<span id="money_sp" style="color: red"></span>
<br>
输入提现密码：<input type="password" name="paypassword" id="paypassword"><br>
<input type="submit" style="border-radius: 5px;" value="确认提现" id="withdrawal">

</body>
<script>
    window.onload=function (){
        $.get("withdrawal3",{},function (date){
            // let op = document.createTextNode("option");
            // let tn = document.createTextNode(date);
            // op.appendChild(tn);
            $("#card2_num").append("<option >"+date+"</option>");
            $.get("withdrawal2",{},function (card_num){

                if (card_num==null){
                    location.href="login.html";
                }else {
                    for (let i=0;i<card_num.length;i++){
                        // let op = document.createElement("option");
                        // let tn = document.createTextNode(date[i]);
                        // op.appendChild(tn);
                        $("#account_id1").append("<option >"+card_num[i]+"</option>");
                    }
                }
            },"json")
        })
    }
    // $("#account_id1").click(function (){
    //
    //
    // })

    $("#money").blur(function (){
        let money = $("#money").val();
        $.get("withdrawal1",{"money":money},function (date){
            if (date=="false"){
                $("#money_sp").html("余额不足");
                return;
            }
        },"text")
        $("#money_sp").html("");
    })

    $("#withdrawal").click(function () {

        let paypassword = $("#paypassword").val();
        let account_id1 = $("#account_id1").val();


        $.get(
            "withdrawal",
            {
                "paypassword": paypassword,
                "account_id1":account_id1
            },
            function (data) {
                if (data=="true"){
                   let a = confirm("提现成功，是否返回首页");
                   if (a==true){
                       location.href="account_index.jsp";
                   }
                }else {
                    alert("密码错误");
                }

        },"text")
    })
</script>
</html>